<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <title>意见反馈</title>
    <link rel="stylesheet" href="__PUBLIC__/Home/css/memberOrder.css">
    <include file="Public/common_js"/>
</head>
<body style="background:white;">
<div class="warp">
    <div class="feedback">
        <div class="member-feedback"><a href="{:url('/MemberComplain/lists')}">查看投诉记录 ></a></div>
        <div class="member-list-template">
            <a href="#">
                <span>订单号:{$order_id}</span>
            </a>
        </div>
        <p class="feedback-template-tips">
            让你生气了真是抱歉，请原谅！
            <br>
            请输入要投诉的内容，我们将尽快给你反馈。或
            <br>
            拨打下面的投诉电话直接与我们联系
        </p>
        <textarea id="message" placeholder="请输入您的反馈意见" class="mgTop message"></textarea>
        <p>输入你的手机号，我们将第一时间给你反馈。</p>
        <input id="tel" type="text" placeholder="手机号码" class="mgTop tel">
        <p class="feedback-template-but"><a href="javascript:;" class="btn btn-second btn-block">提交</a></p>
        <p class="feedback-template-phone"><i><img src="__PUBLIC__/Home/images/phone-icon.png"> </i><a href="tel://{$mobile}">拨打客服电话</a></p>
    </div>
</div>
<script type="text/javascript" src="__PUBLIC__/Home/js/validate.js"></script>
<script type="text/javascript">
    require(['base']);
    $(function () {
		var _isAjaxLoad = false;
        $('.btn-block').click(function () {
			if(_isAjaxLoad) return;
			_isAjaxLoad = true;
            var _message = $('#message').val().trim();
            var _tel = $('#tel').val().trim();
			var msg;
			if(_message == ""){
				_isAjaxLoad = false;
				_global.promote.alertPopup("反馈意见不能为空！");
				return;	
			}
			msg = mbValidator.isMobile(_tel);
			if(msg != ""){
				_isAjaxLoad = false;
				_global.promote.alertPopup(msg);
				return;
			}
			_global.promote.loadPopup();
			var _data = {"order_id" : "<?php echo $order_id;?>", "message" : _message, "tel" : _tel};
            $.ajax({
                type: "POST",
                url: "/Home/MemberComplain/ajax"+getFixedExtraUrl(),
                data: _data,
                dataType: "text",
                success: function (rs) {
                    if (rs == 1) {
                        _global.promote.alertPopup('提交成功！');
                        setTimeout(function(){ window.location.href="{:url('/MemberComplain/lists')}";}, 1000);
                    }else{
						_global.promote.alertPopup('提交失败！');
					}
					_isAjaxLoad = false;
                },
                error: function () {
                    _global.promote.alertPopup('服务器异常，请稍后重试！');
                    _isAjaxLoad = false;
                }
            });
        });
    })
</script>
</body>
</html>
